import service from '../../utils/request'
import { getInfo } from "../../utils/index"
import { BASE_URL } from '@/config/env'
// const BASE_URL = 'https://njhengyu.top/appvd'

/**
 * 用户信息
 * @param {*} data 
 * @returns 
 */
export function userInfo(data){
  return service({
    url: `${BASE_URL}/user/info`,
    data,
    methods: 'GET',
    headers:{
      'Token': getInfo('VideoToken')||''
    }
  })
}
/**
 * 详情
 * @param {*} data 
 * @returns 
 */
export function addonsInfo(data){
  return service({
    url: `${BASE_URL}/addons/detail`,
    data,
    methods: 'GET',
    headers:{
      'Token': getInfo('VideoToken')||''
    },
  })
}
/**
 * 获取视频播放链接
 * @param {*} data 
 * @returns 
 */
export function addonsPlay(data){
  return service({
    url: `${BASE_URL}/charge/video/buy`,
    data,
    methods: 'GET',
    headers:{
      'Token': getInfo('VideoToken')||''
    },
    showModal: true
  })
}
/**
 * 推荐
 * @param {*} data 
 * @returns 
 */
export function addonsRecommend(data){
  return service({
    url: `${BASE_URL}/addons/recommend`,
    data,
    methods: 'POST',
    headers:{
      'Token': getInfo('VideoToken')||''
    }
  })
}
/**
 * 添加/取消追剧
 * @param {*} data 
 * @returns 
 */
export function addOrCancelRecord(data){
  return service({
    url: `${BASE_URL}/user/favorite`,
    data,
    methods: 'POST',
    headers:{
      'Token': getInfo('VideoToken')||''
    },
    showModal: true
  })
}
/**
 * 保存视频进度
 * @param {*} data 
 * @returns 
 */
export function addUserRecord(data){
  return service({
    url: `${BASE_URL}/user/log`,
    data,
    methods: 'POST',
    headers:{
      'Token': getInfo('VideoToken')||''
    }
  })
}
/**
 * 点赞
 * @param {*} data 
 * @returns 
 */
export function userLike(data){
  return service({
    url: `${BASE_URL}/user/like`,
    data,
    methods: 'POST',
    headers:{
      'Token': getInfo('VideoToken')||''
    },
    showModal: true
  })
}
/**
 * 点赞
 * @param {*} data 
 * @returns 
 */
export function productListJf(data){
  return service({
    url: `${BASE_URL}/product/list?type=jf`,
    data,
    methods: 'GET',
    headers:{
      'Token': getInfo('VideoToken')||''
    },
  })
}
/**
 * 点赞
 * @param {*} data 
 * @returns 
 */
export function productList(data){
  return service({
    url: `${BASE_URL}/product/list?type=vip`,
    data,
    methods: 'GET',
    headers:{
      'Token': getInfo('VideoToken')||''
    }
  })
}
